You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Le champ "freetext" du customMap introduit dans #427 ne sera pas utilisé par les éditeurs ; étant optionnel, on préfère le retirer. Plusieurs changements :
ajout de
[tool.mypy]
plugins = [
"pydantic.mypy"
]
Dans le converter/pyproject.toml.
Pourquoi
sinon lefthook ne considère pas le champ freetext du CustomMap comme optionnel, et faire :
initialalert_calltaker=CustomMap(
key="initialalert.calltaker.organization",
label="Identifiant SDIS",
value=calltaker_org,
# sans le champ 'freetext'
)
Levait l'erreur lefthook :
converter/cisu/create_case/create_case_cisu_converter.py:174: error: Missing named argument "freetext"for"CustomMap" [call-arg]
converter/cisu/create_case/create_case_cisu_converter.py:192: error: Missing named argument "freetext"for"CustomMap" [call-arg]
Alors que dans la définition de la classe, on a bien (et c'est du valid pydantic) :
classCustomMap(BaseModel):
key: str=Field(..., description="A valoriser avec le nom de la balise")
value: str=Field(...,description="A valoriser avec la valeur associée à la clé")
label: Optional[str] =Field(None, description="A valoriser avec le libellé correspondant")
freetext: Optional[str] =Field(None,description="Informations complémentaires sur le contexte / utilisation de cette correspondance additionnelle")
J'ai également ajouté le param exclude_none=True au custom_map_entry.model_dump de pydantic, car sinon le freetext était inclus avec sa valeur par défaut :
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔎 Détails
Le champ "freetext" du customMap introduit dans #427 ne sera pas utilisé par les éditeurs ; étant optionnel, on préfère le retirer. Plusieurs changements :
[tool.mypy] plugins = [ "pydantic.mypy" ]Dans le converter/pyproject.toml.
Pourquoi
sinon lefthook ne considère pas le champ
freetextduCustomMapcomme optionnel, et faire :Levait l'erreur lefthook :
Alors que dans la définition de la classe, on a bien (et c'est du valid pydantic) :
J'ai également ajouté le param
exclude_none=Trueaucustom_map_entry.model_dumpde pydantic, car sinon le freetext était inclus avec sa valeur par défaut :avant
{ "freetext": null, "key": "qualification.victims.count", "label": "Nombre de patients-victimes", "value": "NON DEFINI" }après
🔗 Ticket associé
Asana